package com.ms.p2p.dao;



import com.ms.p2p.bean.Stay;
import com.ms.p2p.entity.loan.Loan;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


public interface LoanDao extends CrudDao<Loan> {

    int over(@Param("amount_invested") BigDecimal amount_invested, @Param("time") String time, @Param("borrow_id") Integer id);

    int tender(@Param("money") BigDecimal successAmount, @Param("time") String time, @Param("id") Integer id);

    List<Map<String,Object>> findPager(@Param("borrowId") String borrowId, @Param("userName") String userName, @Param("userId") Integer userId, @Param("borrowType") Integer borrowType, @Param("borrowStatus") Integer borrowStatus, @Param("timeLimitBegin") Integer timeLimitBegin, @Param("timeLimitEnd") Integer timeLimitEnd, @Param("aprBegin") Integer aprBegin, @Param("aprEnd") Integer aprEnd, @Param("lowestAccountBegin") Integer lowestAccountBegin, @Param("lowestAccountEnd") Integer lowestAccountEnd, @Param("borrowStyle") Integer borrowStyle, @Param("begin_time") String begin_time, @Param("end_time") String end_time, @Param("begin") int begin, @Param("size") Integer pageSize);

    Integer findCount(@Param("borrowId") String borrowId, @Param("userName") String userName, @Param("userId") Integer userId, @Param("borrowType") Integer borrowType, @Param("borrowStatus") Integer borrowStatus, @Param("timeLimitBegin") Integer timeLimitBegin, @Param("timeLimitEnd") Integer timeLimitEnd, @Param("aprBegin") Integer aprBegin, @Param("aprEnd") Integer aprEnd, @Param("lowestAccountBegin") Integer lowestAccountBegin, @Param("lowestAccountEnd") Integer lowestAccountEnd, @Param("borrowStyle") Integer borrowStyle, @Param("begin_time") String begin_time, @Param("end_time") String end_time);

	Map<String, Object> totalMoney();

    Loan findCommend();

    int updateOptimistic(Loan map);

    void updateStay(@Param("stay") Stay stay, @Param("id") Integer id);

    void autoLoan(@Param("time") String time);

    Integer count(@Param("userId") String userId, @Param("status") String status);

    Loan findRookie();

    List<Loan> findOverDue(@Param("time") String time);
}
